package com.hl.controller;

import com.hl.domain.Heartexpert;
import com.hl.domain.Hearttest;
import com.hl.service.serviceImpl.HeartTestServiceImpl;
import com.hl.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//心理测评
@RequestMapping("/heartTest")
@RestController
public class HeartTestController {
    @Autowired
    private HeartTestServiceImpl heartTestServiceImpl;

    @GetMapping("/selectAll")
    public R selectAll (){
        return R.success(heartTestServiceImpl.selectAll());
    }

    @GetMapping("/selectLike")
    public R selectLike(String title){
        return R.success(heartTestServiceImpl.selectLike(title));
    }
    //    新增
    @PostMapping("/insert")
    public R insert (Hearttest hearttest){
        return R.success(heartTestServiceImpl.insert(hearttest));
    }
    //    删除
    @DeleteMapping("/delete")
    public R delete(Long id){
        return R.success(heartTestServiceImpl.delete(id));
    }

    //    修改
    @PostMapping("/update")
    public R update(Hearttest hearttest){
        return R.success(heartTestServiceImpl.update(hearttest));
    }



}
